Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
Run This Script On Every Tab Except "Main" Tab

I have this script working well, but I'm uncertain how to make it run on every tab not labeled "Main". Thanks in advance!

function hideRows() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName("Dude");       // Enter sheet name

var row = s.getRange('A2:A').getValues();  // Enter column letter that has the text "hide" and  "unhide"
var cell = s.getRange('A1').getValue();

s.showRows(1, s.getMaxRows());
for(var i=0; i < row.length; i++){ if(row[i] != cell) { s.hideRows(i+2, 1); }   // Value to hide
     
}
}

Jerome

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Run on every sheet except Main

I assume that you are running the onEdit trigger.

function hideRows(e) {
  const s = e.range.getSheet();
  if(s.getName() == "Main") return;
  var row = s.getRange(2,1,s.getLastRow() -1 ).getValues().flat();
  var cell = s.getRange('A1').getValue();
  s.showRows(1, s.getLastRow());
  for (var i = 0; i < row.length; i++) {
    if (row[i] != cell) { s.hideRows(i + 2, 1); }
  }
}

Want to exclude more sheets

function hideRows(e) {
  const s = e.range.getSheet();
  const ex = ['Main','Sheetx'];//excluded sheet names
  const idx = ex.indexOf(s.getName());
  if(~idx) return;
  var row = s.getRange(2,1,s.getLastRow() -1 ).getValues().flat();
  var cell = s.getRange('A1').getValue();
  s.showRows(1, s.getLastRow());
  for (var i = 0; i < row.length; i++) {
    if (row[i] != cell) { s.hideRows(i + 2, 1); }
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda